 // 分页
 var page = document.getElementById("page");
 var btns = page.getElementsByClassName("myBtn");
 console.log(btns);
 var span = document.querySelector(".pageCount");
//初始页码
var pageIndex = 1;
var pageSize = 5;
// 封装页面渲染
function response(result){
    pageCount = result.dataset.pageCount;
    span.innerHTML='共'+pageCount+"页,当前页数"+pageIndex+"页";
    
}

// 封装分页当前按钮是否能点击
function check(){
    console.log(pageCount,pageIndex,pageSize);
    span.innerHTML='共'+pageCount+"页,当前页数"+pageIndex+"页";
    if(pageIndex == 1 && pageIndex == pageCount){
        btns[0].disabled = true;
        btns[1].disabled = true;
        btns[2].disabled = true;
        btns[3].disabled = true;
    }else if(pageIndex == 1){//第一页
        btns[0].disabled = true;
        btns[1].disabled = true;
        btns[2].disabled = false;
        btns[3].disabled = false;
    }else if(pageIndex == pageCount){//最后
        btns[0].disabled = false;
        btns[1].disabled = false;
        btns[2].disabled = true;
        btns[3].disabled = true;
    }else{//中间
        btns[0].disabled = false;
        btns[1].disabled = false;
        btns[2].disabled = false;
        btns[3].disabled = false;
    }
}
check();
classOnload(1);
console.log(pageCount,pageIndex,pageSize);
// 封装控制页码的函数
function package1(page){
switch(page){
    case 0:
            pageIndex = 1;
            break;
    case 1:
            pageIndex -= 1;
            break;
    case 2:
            pageIndex += 1;
            break;
    case 3:
            pageIndex = pageCount;
            break;
}
// 进行页面重新渲染
classOnload(pageIndex);
// function classOnload(){

// }
// 当前页面分页按钮是否能点击
check();
}
